import java.util.Arrays;

public class Solution283 {
    public void moveZeroes(int[] nums) {
        int start=-1;
        for (int i=0;i<nums.length;i++){
            if (nums[i]!=0) {
                if (start!=-1) {
                    int temp = nums[i];
                    nums[i] = nums[start];
                    nums[start] = temp;
                    start++;
                }
            }else{
                if (start==-1){
                    start=i;
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] nums=new int[]{0,1,0,3,12};
        new Solution283().moveZeroes(nums);
        System.out.println(Arrays.toString(nums));
    }
}
